POV-Ray : Newsgroups : povray.general : Lemon : Re: Lemon Server Time
1 Aug 2024 04:10:58 EDT (-0400)
  Re: Lemon  
From: Chris B
Date: 17 Mar 2006 09:29:50
Message: <441ac7de$1@news.povray.org>
"Mike Williams" <nos### [at] econymdemoncouk> wrote in message 
news:hdq74DAPgqGEFw+p### [at] econymdemoncouk...
> Wasn't it Shark who wrote:
>>Hi,
>>
>>I'm trying to create a shape called a "lemon"
>>(http://mathworld.wolfram.com/Lemon.html) using POV-Ray, but am
>>encountering problems.
>>I need it to have a well-defined inside, so simply clipping a spindle 
>>torus
>>won't work.
>>Also, I'm unsure about the exactness when using a lathe or SOR object.
>>
>>Does anyone have any suggestions?
>
> Try this:
>
> #declare r1 = 0.6;
> #declare r2 = 1.0;
> #declare  F = function {x*x + y*y - r2*r2}
>
> isosurface {
>  function { F(sqrt(x*x+z*z)+r1, y, z) }
>  max_gradient 3.1
>  contained_by{sphere{0,r2}}
>  pigment {rgb <1,1,0>}
> }
>
> max_gradient will need tweaking for different values of r1 and r2.
> -- 
> Mike Williams
> Gentleman of Leisure

Interestingly on rendering the three solutions side-by-side I see that 
Mike's solution is the only one that gets lit correctly.
I'm not sure why this should be. I've adjusted the light in the SDL below to 
emphasize the effect, in case anyone can shed light on this.

Regards,
Chris B.

camera {location <0,0,-2.5> look_at 0}
light_source {<0,20,-20>,1}

#local MajorRadius = 0.6;
#local MinorRadius = 1;
#local SphereRadius = pow(pow(MinorRadius,2)-pow(MajorRadius,2),0.5);

difference {
  sphere {0,SphereRadius}
  torus {MajorRadius,MinorRadius}
  pigment {color rgb <1,0,1>}
  translate -x
}

torus {MajorRadius,MinorRadius inverse
  pigment {color rgb <0,1,1>}
  clipped_by {sphere {0,SphereRadius}}
  translate x
}

#declare r1 = 0.6;
#declare r2 = 1;
#declare  F = function {x*x + y*y - r2*r2}

isosurface {
  function { F(sqrt(x*x+z*z)+r1, y, z) }
  max_gradient 3.1
  contained_by{sphere{0,r2}}
  pigment {rgb <1,1,0>}
}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.